﻿@namespace BulmaRazor.Components
@inherits BulmaComponentBase
<nav @attributes="Attributes" class="@classes">

    @if (HeaderText.HasValue() || HeaderSlot != null)
    {
        <p class="panel-heading">
            @if (HeaderSlot != null)
            {
                @:@HeaderSlot
            }
            else
            {
                @:@HeaderText
            }
        </p>
    }
    @ChildContent
</nav>

@code {

    string classes => CssBuilder.Default("panel")
        .AddClassFromAttributes(Attributes)
        .AddClass(Color.Value, Color.Value)
        .Build();

    /// <summary>
    /// 颜色
    /// </summary>
    [Parameter]
    public Color Color { get; set; } = Color.Default;

    /// <summary>
    /// 头部文本
    /// </summary>
    [Parameter]
    public string HeaderText { get; set; }

    /// <summary>
    /// 头部卡槽
    /// </summary>
    [Parameter]
    public RenderFragment HeaderSlot { get; set; }

    /// <summary>
    /// 子内容
    /// </summary>
    [Parameter]
    public RenderFragment ChildContent { get; set; }

}